package stz.flash.main;

import net.rim.device.api.system.Characters;
import net.rim.device.api.ui.Keypad;
import net.rim.device.api.ui.TouchEvent;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.PopupScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;

public class OverLimitTimeScreen extends PopupScreen{

	public OverLimitTimeScreen(String message) {
		super(new VerticalFieldManager());
		add(new LabelField(message));
	}
	
	protected boolean keyDown(int keycode, int time) {
		// TODO Auto-generated method stub
		return true;
	}
	
	protected boolean keyUp(int i, int j) {
		if (checkCloseKey(i))
			close();
		return true;
	}

	private boolean checkCloseKey(int i) {
		return Keypad.key(i) == Characters.ESCAPE
				| Keypad.key(i) == Keypad.KEY_END
				| Keypad.key(i) == Characters.ENTER
				| Keypad.key(i) == Characters.SPACE;
	}
	
	protected boolean navigationClick(int i, int j) {
		close();		
		return super.navigationClick(i, j);
	}
	
	protected boolean touchEvent(TouchEvent touchevent) {
		if (touchevent.getEvent() == TouchEvent.UP)
			close();
		return super.touchEvent(touchevent);
	}
}
